<template>
  <div class="container">
    <!--<Title title="速城招聘网为您提供最及时的招聘信息"></Title>-->
    <!--<TabNav>  </TabNav>-->
    <!--<div class="job-ad">-->
      <!--<image src="../../static/job-ad.png" />-->
    <!--</div>-->
    <!--<JobList :needtext="false"> </JobList>-->

    <Job :jobList="jobList" :navlist="navlist" :banner="banner"> </Job>
  </div>
</template>
<script>
  const wxapp = getApp();
  // import Title from '@/components/Title'
  // import TabNav from '@/components/TabNav'
  // import JobList from '@/components/Index/JobList'
  import Job from '@/components/job/Job'

  export default {

    data() {
      return {
        page: 1,
        jobList: [],
        navlist: [],
        banner: '../../static/job-ad.png'
      }
    },

    components:{
      // Title,
      // TabNav,
      // JobList,
      Job
    },
    onShow() {
      this.getList()
      this.getCate()
    },
    methods: {
      getList() {
        wx.showLoading({
  title: '加载中',
})
        let that = this
        wx.request({
          url: wxapp.globalData.ROOT_URL, //仅为示例，并非真实的接口地址
          data: {
             siteid: '4' ,
             service: 'App.Hong.Index',
             page: that.page,
             table: '4_jobs',
             ftable: '4_jobs_category'
          },
          success: function(res) {
            wx.hideLoading()
            that.isLoading = false
            if(res.data.data.result == 0) {
              wx.showToast({
                title: '没有了',
                icon: 'success',
                duration: 2000
              })
              that.isNext = false
            }else {
              let list = res.data.data.result
              if(that.page >1) {
                let jobList = that.jobList
                for(let i in list) {
                  jobList.push(list[i])
                }
                that.jobList = jobList
              }else {
                that.jobList = list
              }
            }
            console.log(that.jobList)

          }
        })
      },
      getCate() {
        wx.showLoading({
  title: '加载中',
})
        let that = this
        wx.request({
          url: wxapp.globalData.ROOT_URL, //仅为示例，并非真实的接口地址
          data: {
             service: 'App.Hong.GetCategory',
             table: '4_jobs_category'
          },
          header: {
              'content-type': 'application/json' // 默认值
          },
          success: function(res) {
            wx.hideLoading()
            that.navlist = res.data.data.result
            that.banner = that.navlist[0]['thumb'];
          }
        })
      }
    }
  }
</script>
<style scoped>
  .job-ad{
    height: 274rpx;

  }
  .job-ad image{
    width: 100%;
    height: 274rpx;
  }
</style>
